package com.hitales.liteflow.liteflowdemo.declarative.demo1;

import com.hitales.liteflow.liteflowdemo.contextdemo.CustomContext;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.flow.LiteflowResponse;
import com.yomahub.liteflow.flow.entity.CmpStep;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class LiteflowSwitchService {

    @Autowired
    private FlowExecutor flowExecutor;

    public void test() {
        LiteflowResponse response = flowExecutor.execute2Resp("love", "参数", CustomContext.class);
        System.out.println(response.isSuccess());
        Map<String, List<CmpStep>> executeSteps = response.getExecuteSteps();
        executeSteps.forEach((key, value) -> {
            value.forEach(data -> System.out.println(data.getNodeId()));
        });
    }
}
